﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ingesup_ERP.Models;

namespace ingesup_ERP.Controllers
{
    public class homeController : Controller
    {
        db bdd = new db();
        //
        // GET: /home/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult inscription()
        {
            return View();
        }

        [HttpPost]
        public ActionResult inscription(ADMINISTRATEUR admin)
        {
            bdd.ADMINISTRATEUR.InsertOnSubmit(admin);
            bdd.SubmitChanges();
            return RedirectToAction("index");
        }

        public ActionResult afficher(string log)
        {
            ADMINISTRATEUR admin = bdd.ADMINISTRATEUR.Where(a => a.LOGINPERS == log).First();
            return View(admin);
        }

        public ActionResult affichertout()
        {
            List<ADMINISTRATEUR> admins = bdd.ADMINISTRATEUR.ToList();
            return View(admins);
        }


    }
}
